import Cookies from 'js-cookie';

const TokenKey = 'token';

// 从cookie中读取token
export function getToken() {
    console.log('token  ----->  ', Cookies.get(TokenKey));
    return Cookies.get(TokenKey);
}

// 存储token到cookie
export function setToken(token) {
    console.log('  ----->  ', token);
    return Cookies.set(TokenKey, token);
}

// 删除token
export function removeToken() {
    return Cookies.remove(TokenKey);
}

// 存储token时间的逻辑
const timeKey = 'vue-admin-time-key';

// 存储时间戳
export function saveTime() {
    Cookies.set(timeKey, Date.now());
}
// 读取时间戳
export function getTime() {
    return Cookies.get(timeKey);
}
